import { createRouter, createWebHistory } from 'vue-router'
import Home from '@/views/Home.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    { path: '/', redirect: '/login',},
    { name: 'manager', path: '/Manager',component:()=>import('../layout/manager.vue'),meta:{transition:'slide-right'},
      children:[
          { name:'home', path: 'home', meta:{title:"主页" ,transition:'slide-right'}, component:()=>import('../views/Home.vue')},
          { path:"data",name:'data', meta:{title: '数据',transition:'slide-right'}, component:()=>import('../views/Data.vue')},
          { path:"employee",name:'employee', meta:{title: '员工信息',transition:'slide-right'}, component:()=>import('../views/employee.vue')},
          { path:"admin",name:'admin', meta:{title: '管理员信息',transition:'slide-right'}, component:()=>import('../views/Admin.vue')},
          { path:"person",name:'person', meta:{title: '个人信息',transition:'slide-right'}, component:()=>import('../views/Person.vue')},
          { path:"password", meta:{title: '修改密码',transition:'slide-right'}, component:()=>import('../views/Password.vue')},
          { path:"article", meta:{title: '文章信息',transition:'slide-right'}, component:()=>import('../views/Article.vue')},
          { path:"department", meta:{title: '部门信息',transition:'slide-right'}, component:()=>import('../views/department.vue')},
          { path:"file", meta:{title: '文件管理',transition:'slide-right'}, component:()=>import('../views/File.vue')},
          { path:"userinfo", meta:{title: '个人中心',transition:'slide-right'}, component:()=>import('../views/UserInfo.vue')},
      ]},
      { path:'/login',name:'Login',meta:{title:'登录系统',transition:'slide-right'},component:()=>import('../views/Login.vue')},
      { path:'/register',name:'register',meta:{title:'注册页面',transition:'slide-right'},component:()=>import('../views/register.vue')},
      { path:'/404',name:'Notfound',meta:{title:'404找不到页面',transition:'slide-right'},component:()=>import('../views/404.vue')},
      {path:'/:pathMatch(.*)',redirect:'/404'},
  ]
})

router.beforeEach((to, from, next) => {
        document.title=to.meta.title
        next()
})
export default router
